#ifndef _DevicesPower_H_
#define _DevicesPower_H_



#define POWER_CHANNEL_SYSTEM_PD     0x01
#define POWER_CHANNEL_USB_OUT       0x02
#define POWER_CHANNEL_ADS24V_OUT    0x04
#define POWER_CHANNEL_DC24V_OUT     0x10
#define POWER_CHANNEL_DC12V_OUT     0x20
#define POWER_CHANNEL_ALL           0xFF



/* 连接到开机按键，以模拟开机按键的按下动作 */
#define POWER_SYSTEM_PD_GPIO_Port   GPIOE
#define POWER_SYSTEM_PD_Pin         GPIO_PIN_3

#define POWER_DC24V_OUT_GPIO_Port   GPIOE
#define POWER_DC24V_OUT_Pin         GPIO_PIN_7

#define POWER_DC12V_OUT_GPIO_Port   GPIOD
#define POWER_DC12V_OUT_Pin         GPIO_PIN_10

#define POWER_USB_OUT_GPIO_Port     GPIOE
#define POWER_USB_OUT_Pin           GPIO_PIN_8

#define POWER_ADS24V_OUT_GPIO_Port  GPIOA
#define POWER_ADS24V_OUT_Pin        GPIO_PIN_11



#define POWER_SYSTEM_PD_ENABLE()    gpio_bit_set(POWER_SYSTEM_PD_GPIO_Port, POWER_SYSTEM_PD_Pin)
#define POWER_SYSTEM_PD_DISABLE()   gpio_bit_reset(POWER_SYSTEM_PD_GPIO_Port, POWER_SYSTEM_PD_Pin)

#define POWER_USB_OUT_ENABLE()      gpio_bit_set(POWER_USB_OUT_GPIO_Port, POWER_USB_OUT_Pin)
#define POWER_USB_OUT_DISABLE()     gpio_bit_reset(POWER_USB_OUT_GPIO_Port, POWER_USB_OUT_Pin)

#define POWER_ADS24V_OUT_ENABLE()   gpio_bit_set(POWER_ADS24V_OUT_GPIO_Port, POWER_ADS24V_OUT_Pin)
#define POWER_ADS24V_OUT_DISABLE()  gpio_bit_reset(POWER_ADS24V_OUT_GPIO_Port, POWER_ADS24V_OUT_Pin)

#define POWER_DC12V_OUT_ENABLE()    gpio_bit_reset(POWER_DC12V_OUT_GPIO_Port, POWER_DC12V_OUT_Pin)
#define POWER_DC12V_OUT_DISABLE()   gpio_bit_set(POWER_DC12V_OUT_GPIO_Port, POWER_DC12V_OUT_Pin)

#define POWER_DC24V_OUT_ENABLE()    gpio_bit_set(POWER_DC24V_OUT_GPIO_Port, POWER_DC24V_OUT_Pin)
#define POWER_DC24V_OUT_DISABLE()   gpio_bit_reset(POWER_DC24V_OUT_GPIO_Port, POWER_DC24V_OUT_Pin)


void vPowerInit(void);
void vPowerOpen(uint16_t usNumber);
void vPowerClose(uint16_t usNumber);

#endif
